package main

import (
    "facecat"
    "io/ioutil"
)

var gPaint = new(facecat.FCPaint)

func WndProc(hwnd facecat.HWND, msg uint32, wParam, lParam uintptr) (result uintptr) {
    return facecat.WndProcDefault(gPaint, hwnd, msg, wParam, lParam)
}

func main() {
    gPaint = facecat.CreatePaint()
    facecat.CreateMainWindow(gPaint, "FaceCat-Go", WndProc)
    xmlStr, _ := ioutil.ReadFile("xml//tabviewexample.xml")
    facecat.RenderFaceCat(gPaint, string(xmlStr))
    //获取第二页
    tabPage := facecat.FindViewByName("TabPage2", gPaint.Views)
    tabView2 := facecat.CreateView("tabview")
    tabView2.Location = facecat.CreatePoint(50, 50)
    tabView2.Size = facecat.CreateSize(400, 300)
    facecat.AddViewToParent(tabView2, tabPage)
    for i := 0; i < 4; i++{
        newTabPage := facecat.CreateView("tabpage")
        tabButton := facecat.CreateView("button")
        tabButton.Size = facecat.CreateSize(100, 20)
        tabButton.ViewType = "tabbutton"
        tabButton.Text = "选项"
        facecat.AddTabPage(tabView2, newTabPage, tabButton)
    }
    facecat.UpdateTabLayout(tabView2)
    facecat.ShowWindow(gPaint)
}